package com.y.utils;

import com.y.config.exception.BusinessException;
import com.y.entity.vo.RHttpStatusEnum;

/**
 * @author: Yjh
 */
public class Assert {

    public static void isTrue(boolean condition, RuntimeException e){
        if (!condition){ // 不为真 抛异常
            throw e;
        }
    }

    public static void notTrue(boolean condition, RuntimeException e){
        if (condition){ // 为真 抛异常
            throw e;
        }
    }

    public static void notNull(Object o, RuntimeException e){
        if (o == null){ // 为null 抛异常
            throw e;
        }
    }

    public static void isNull(Object o, RuntimeException e){
        if (o != null){ // 不为null 抛异常
            throw e;
        }
    }

    public static void isEquals(Object param1,Object param2, RuntimeException e){
        if (!param1.equals(param2)){ // 不为真 抛异常
            throw e;
        }
    }

}
